﻿using SUNRPA.CONTROLS.IMPL.domain.constant;
using System.Runtime.InteropServices;

namespace SUNRPA.CONTROLS.IMPL.domain {
    /*字段说明:cbSize结构体FLASHWINFO的大小.
    hwnd要闪动的窗体的句柄.窗体可以是打开的也可以是最小化的.
    dwFlags:闪动的状态/标志. 此参数可以是以下的值或值的组合(用或操作符"|"组合)值
    含义
    FLASHW_ALL
    0x00000003
    闪动窗体标题和任务栏按钮,等于将此参数设置为:

    FLASHW_CAPTION | FLASHW_TRAY.
    FLASHW_CAPTION
    0x00000001
    闪动窗体的标题.

    FLASHW_STOP
    0
    停止闪动.系统将窗体恢复到初始状态.

    FLASHW_TIMER
    0x00000004
    连续不停的闪动,直到此参数被设置为:FLASHW_STOP

    FLASHW_TIMERNOFG
    0x0000000C
    连续不停的闪动,直到窗体用户被激活.通常用法将参数设置为: FLASHW_ALL | FLASHW_TIMERNOFG

    FLASHW_TRAY
    0x00000002
    闪动任务栏按钮

    uCount闪动的次数.
    dwTimeout闪动频率,单位毫秒. 如果dwTimeout值为0, 函数使用光标的闪动频率.*/
    [StructLayout(LayoutKind.Sequential)]
    public struct FLASHWINFO{
        public UInt32 cbSize;
        public IntPtr hwnd;
        public UInt32 dwFlags;
        public UInt32 uCount;
        public UInt32 dwTimeout;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct POINT{
        public int x;
        public int y;
    }
    //鼠标钩子消息体
    [StructLayout(LayoutKind.Sequential)]
    public struct MouseParamStruct {
        /// <summary>
        /// POINT结构对象，保存鼠标在屏幕上的x,y坐标
        /// </summary>
        public POINT pt;
        /// <summary>
        /// 接收到鼠标消息的窗口的句柄
        /// </summary>
        public IntPtr hWnd;
        /// <summary>
        /// hit-test值，详细描述参见WM_NCHITTEST消息
        /// </summary>
        public int wHitTestCode;
        /// <summary>
        /// 指定与本消息联系的额外消息
        /// </summary>
        public int dwExtraInfo;
    }

    //键盘钩子消息体
    [StructLayout(LayoutKind.Sequential)]
    public struct KeyParamStruct {
        /// <summary>
        /// 虚拟按键码(1--254)
        /// </summary>
        public int vkCode;
        /// <summary>
        /// 硬件按键扫描码
        /// </summary>
        public int scanCode;
        /// <summary>
        /// 键按下：128 抬起：0
        /// </summary>
        public int flags;
        /// <summary>
        /// 消息时间戳间
        /// </summary>
        public int time;
        /// <summary>
        /// 额外信息
        /// </summary>
        public int dwExtraInfo;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct Rect{
        public int Left;
        public int Top;
        public int Right;
        public int Bottom;
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct SoftWareInfo{
        public string DisplayName;
        public string InstallLocation;
        public string UninstallString;
        public string DisplayVersion;
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct UserInfo{
        public string accountId { get; set;}
        public string accountName{ get; set;}
        public string password{ get; set;}
        public string email{ get; set;}
        public string phoneNum{ get; set;}
        public string userType{ get; set;}
    }


    public struct NamePipeRequest { 
        public NamePipeRequest(string method, Dictionary<string, object> requestData) { 
            this.method = method;
            this.requestData = requestData;
        }
        //请求的方法
        public string method { get; set;}
        //请求的参数
        public Dictionary<string, object> requestData { get; set;} 
    }

    public struct BridgeResponse { 
        public CommunicationCode code { get; set;}

        public string msg { get; set;}

        public object result { get; set;}
    }

    public struct BrowserRequest { 
    
        public string method { get; set;}
        //请求的参数
        public Dictionary<string, object> requestData { get; set;} 
        public string script { get; set;}

    }

    [StructLayout(LayoutKind.Sequential)]
    public struct SECURITY_ATTRIBUTES{
        public int nLength;
        public IntPtr lpSecurityDescriptor;
        public int bInheritHandle;
    }

    [StructLayout(LayoutKind.Sequential)]
    struct JOBOBJECT_BASIC_LIMIT_INFORMATION{
        public Int64 PerProcessUserTimeLimit;
        public Int64 PerJobUserTimeLimit;
        public Int16 LimitFlags;
        public UInt32 MinimumWorkingSetSize;
        public UInt32 MaximumWorkingSetSize;
        public Int16 ActiveProcessLimit;
        public Int64 Affinity;
        public Int16 PriorityClass;
        public Int16 SchedulingClass;
    }

    [StructLayout(LayoutKind.Sequential)]
    struct IO_COUNTERS{
        public UInt64 ReadOperationCount;
        public UInt64 WriteOperationCount;
        public UInt64 OtherOperationCount;
        public UInt64 ReadTransferCount;
        public UInt64 WriteTransferCount;
        public UInt64 OtherTransferCount;
    }

    [StructLayout(LayoutKind.Sequential)]
    struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION{
        public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
        public IO_COUNTERS IoInfo;
        public UInt32 ProcessMemoryLimit;
        public UInt32 JobMemoryLimit;
        public UInt32 PeakProcessMemoryUsed;
        public UInt32 PeakJobMemoryUsed;
    }
}
